package com.kfm.base.ex;

public class Demo01 {

    public static void main(String[] args) {
        /*
          计算 5 的阶乘

          5! = 5 * 4 * 3 * 2 * 1 = 5 * 4!
         */
        int num = 5;
        int result = jc(num);
        System.out.println(result);
    }


    public static int jc(int num) {
        if (num == 1 || num == 0){
            return 1;
        }
        return num * jc(num - 1);
    }
}
